# test/CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(Tests)

# 包含路径
include_directories(../includes/raylib)
include_directories(../includes)

set(CMAKE_CXX_STANDARD 20)

# 查找raylib库
find_library(RAYLIB_LIB
    NAMES libraylib libraylibdll raylib
    PATHS ../libs/raylib/lib
    REQUIRED
)

# 编译测试文件
file(GLOB_RECURSE TEST_FILES CONFIGURE_DEPENDS
        "*.cpp"
        "*.c" 
    LIST_DIRECTORIES false
)

foreach(test_file ${TEST_FILES})
    get_filename_component(program_name ${test_file} NAME_WE)
    add_executable(${program_name} ${test_file})
    target_link_libraries(${program_name} ${RAYLIB_LIB} opengl32 winmm imm32 gdi32)
    
endforeach()

# 复制资源文件
if(EXISTS "../assets")
    file(COPY ../assets DESTINATION ${CMAKE_BINARY_DIR})
endif()